
async function resizeImage(imageBuffer: Buffer, width: number = 200, height: number = 200): Promise<Buffer> {
    const { createCanvas, loadImage } = require('@napi-rs/canvas')
    const image = await loadImage(imageBuffer);
    const canvas = createCanvas(width, height);
    const ctx = canvas.getContext('2d');
    ctx.drawImage(image, 0, 0, width, height);
    return await canvas.encode('jpeg');
}

export default resizeImage